from django.db import models


# Create your models here.

# 一类
class BookInfo(models.Model):
    """书籍"""
    title = models.CharField(max_length=20)
    author = models.CharField(max_length=20, default="佚名")
    money = models.FloatField(default=0.00)
    time = models.DateField()


# 多类
class HeroInfo(models.Model):
    """人物"""
    name = models.CharField(max_length=20)
    age = models.IntegerField()
    gender = models.BooleanField(default=False)  # 默认为False = 男
    descripthion = models.CharField(max_length=30)
    fromBook = models.ForeignKey(BookInfo, on_delete=models.CASCADE)
